#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void my_func(int sign_no)
{
    if(sign_no == SIGINT)
      printf("I have get SIGINT\n");
    else if(sign_no == SIGQUIT)
      printf("I have get SIGQUIT\n");
}
int main()
{
    printf("waiting for signal SIGINT or SIGQUIT \n"); 
    //发出相应的信号，并跳转到信号处理函数处
    signal(SIGINT,my_func);//ctrl + c
    printf("SIGINT has been sent!\n"); 
    signal(SIGQUIT,my_func);//ctrl + '\'
    printf("SIGQUIT has been sent!\n"); 
    pause();
    exit(0);
}
